home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 3 / Amiga Tools 3.iso / grafik / raytracing / rayshade-4.0.6.3 / inetray / inetray.ping.c < prev    next >
C/C++ Source or Header  |  1993-08-15  |  2KB  |  63 lines

  1. /*======================================================================
  2.                     I N E T R A Y . P I N G . C 
  3.                     doc: Thu Mar  5 12:55:31 1992
  4.                     dlm: Thu Jul 22 15:30:41 1993
  5.                     (c) 1992 ant@julia
  6.                     uE-Info: 57 50 T 0 0 72 2 2 8 ofnI
  7. ======================================================================*/
  8.  
  9. #include    <stdio.h>
  10. #include    <signal.h>
  11. #include    <ctype.h>
  12. #include    <sys/param.h>
  13. #include    <rpc/rpc.h>
  14. #include    "inetray.h"
  15. #include    "config.h"
  16. #include    "common.h"
  17. #include    "comm.h"
  18. #include    "version.h"
  19. #include    "patchlevel.h"
  20.  
  21. int     key = 0;            /* dummy key */
  22.  
  23. static void cleanUp()            /* clean up self */
  24. {
  25.     int     i;
  26.  
  27.     for (i=SIGHUP; i<=SIGQUIT; i++)
  28.         signal(i,SIG_IGN);
  29.     fprintf(stderr,"Exiting... [terminate"); 
  30.     terminateAll();
  31.     fprintf(stderr,", close");
  32.     closeAll();
  33.     fprintf(stderr,"]\n");
  34.     exit(0);
  35. }
  36.  
  37. main(ac,av)
  38. int ac; char *av[];
  39. {
  40.     int     i;
  41.     char    hName[MAXHOSTNAMELEN],cwd[MAXPATHLEN];
  42.     char    *getcwd();
  43.  
  44.     if (gethostname(hName,MAXHOSTNAMELEN) < 0) {
  45.         perror("gethostname");
  46.         exit(1);
  47.     }
  48.     
  49.     for (i=SIGHUP; i<=SIGQUIT; i++)
  50.         signal(i,cleanUp);
  51.     fprintf(stderr,"%s [%s%d]\n",av[0],VERSION,PATCHLEVEL);
  52.  
  53.     if (ac == 1) readRc();
  54.     else addUseList(ac,av);
  55.         
  56.         fprintf(stderr,"Pinging... ["); 
  57.         registerSvc(hName,"",getcwd(cwd,MAXPATHLEN),FALSE);
  58.         if (nRunning == 0) fprintf(stderr,"\n[Warning: ");
  59.         else               fprintf(stderr,"\n[");
  60.     fprintf(stderr,"%d workers answered]\n",nRunning);
  61.     cleanUp();
  62. }
  63.